<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--1、引入vue.js-->
    <script src="./js/vue.js"></script>
    <title>Document</title>
</head>

<body>
    <!--2、编写页面（视图）创建一个视图-->
    <div id="app">
        <!--1+1=2 v-model-->
        <input type ="text" v-model="first">+<input type ="text" v-model="second">=<input type ="text" v-model="result">
        <button v-on:click="add()">计算</button>
        <!--{{first}}+{{second}}={{first+second}}-->
    </div>
</body>

</html>
<script>
    //3、编写vue实例
    //document.getElementById("")
var app = new Vue({
    el: '#app',
    data(){
        return{
            first:0,
            second:0,
            result:0
        }
        
    },
    methods:{
        add(){
            this.result = parseInt(this.first)+parseInt(this.second)
        }
    }
 
})

</script>